<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center advertisementManage_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub advertisementManage_fd0_0'>
				<view class='flex flex-wrap align-center'>
					<person></person>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='advertisementManage_fd0_0_c1_c0'>发布交友广告</text>
				</view>
				<view class='flex flex-wrap align-center advertisementManage_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<view style="padding: 8rpx 30rpx;background: #fff;">
			<back></back>
		</view>
		<!---flex布局flex布局开始-->
		<view class="advertisementManage_flex_1" >
			<!-- <view class='flex flex-wrap align-center advertisementManage_fd1_0' @tap.stop="popupShow1683691899896=true">
				<text class='advertisementManage_fd1_0_c0'>选择时间</text>
				<input class='advertisementManage_fd1_0_c1' type="text" placeholder="请选择时间" confirm-type="done"
					:maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="shijian"
					disabled="true" />
				<text class='fu-iconfont2  advertisementManage_fd1_0_c2'>&#xe7f2;</text>
			</view>
			<view class='flex flex-wrap align-center justify-between advertisementManage_fd1_0'>
				<text class='advertisementManage_fd1_0_c0'>价格</text>
				<text class='advertisementManage_fd1_0_c0'>{{jiage.ads_price}}/小时</text>
			</view> -->
			<!-- <view class="ad_content">
				<view class="ad_title">
					<text v-if="adTime.ads_time == 0">暂未开通广告</text>
					<template v-else>
						<text>剩余时间： </text>
						<u-count-down :timestamp="adTime.ads_time" separator="zh" font-size="28" separator-size="26" separator-color="#8B060D" @end="timeEnd"></u-count-down>
					</template>
					
				</view>
				<view class="ad_quanyi">权益</view>
				<view class="ad_quanyi_text">
					<jyf-parser :html="adTime.ads_rights | richTextFormat"></jyf-parser>
				</view>
			</view> -->
			
			<view class="select_ad" v-if="!is_submit">
				<view class="select_ad_title">广告设置</view>
				<view class="select_ad_date">
					<view class="date_left">广告时长</view>
					<view class="date_right">
						<zxz-uni-data-select :placeholder="'选择时间'" v-model="time" :localdata="jiage.ads_time" dataKey="label" dataValue="value" @change="selectChange"></zxz-uni-data-select>
					</view>
				</view>
				<view class="select_ad_date">
					<view class="date_left_2">价格(金币)</view>
					<view class="date_right_2">
						{{jiage.ads_price}}/小时
					</view>
				</view>
			</view>
			<view class="upload_content" v-else>
				<view class="upload_1 position-relative" >
					<image class=" authentication_fd1_1_c0_image_1" mode="aspectFill" :src="STATIC_URL+'49.png'">
					</image>
				</view>
				<!-- <view class="button_1">已认证</view> -->
				<view class="tips">提交成功，请等待后台审核</view>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<view class="flex flex-direction flex-wrap align-center benben-position-layout flex advertisementManage_flex_2" v-if="!is_submit">
			<button class='advertisementManage_fd2_0' @tap.stop="getsetpay">确定</button>

		</view>
		<view :style="{height: '152rpx'}"></view>
		<!--区号选择器开始 -->
		<benben-picker ref="benbenWritePickerCodepicker11" :visible.sync="popupShow1683691899896" :label.sync='shijian'
			:value.sync='list' :options='jiage.ads_time' mode='selector' :mask-show='true' :timeout='true'
			:picker-height='88' default-type='value' :default-props='{"label":"label","value":"value"}'>
			<template #picker-header>
				<view class='flex flex-wrap align-center justify-between MyInformation_picker5_0'>
					<text @tap="$refs.benbenWritePickerCodepicker11.cancel()">取消</text>
					<text>选择时间</text>
					<text class='MyInformation_picker5_0_c2'
						@tap="$refs.benbenWritePickerCodepicker11.pickerConfirm()">确认</text>
				</view>
			</template>
		</benben-picker>
		
		
		<!-- <u-popup v-model="ad_show" mode="center" border-radius="16">
			<view class="confirm_popup">
				<view class="popup_title">
					<text></text>
					<text>购买服务确认</text>
					<image :src='STATIC_URL+"121.png"' mode="aspectFill"></image>
				</view>
				<view class="popup_cont">
					<view class="cont_item">
						<view class="popup_cont_left">
							<view>您已选择</view>
						</view>
						<view class="popup_cont_right">
							<text>{{selectInfo.name}}</text>
							<text class="cont_right_date">(有效期{{selectInfo.times}}个月)</text>
						</view>
					</view>
					<view class="cont_item">
						<view class="popup_cont_left">
							<view>服务价格</view>
						</view>
						<view class="popup_cont_right">
							<text>{{selectInfo.money}}金币</text>
						</view>
					</view>
					<view class="cont_item">
						<view class="popup_cont_left">
							<view>我的余额</view>
						</view>
						<view class="popup_cont_right">
							<text>{{Number(usefInfo.user_money)}}金币</text>
						</view>
					</view>
					<view class="cont_item">
						<view class="popup_cont_left">
							<view class="xuyao">需支付</view>
						</view>
						<view class="popup_cont_right">
							<text>{{selectInfo.money}}金币</text>
						</view>
					</view>
				</view>
				<view class="popup_bottom">
					<view class="confirm_btn" @tap.stop="payNow">立即支付</view>
				</view>
			</view>
		</u-popup> -->
		

		<benben-popup v-model="popupShow1688203058831" :mask="true" mode='center'>
			<view class="flex flex-direction align-stretch benben-flex-layout vip_flex_311">
				<view class='flex align-center justify-center'>
					<text class='vip_fd3_0_c0'>输入支付密码</text>
				</view>
				<view class='flex align-center justify-center vip_fd3_1'>
					<benben-digital-password :box-num='6' mode='password' v-model='PayPwd'
						class-name="flex flex align-center justify-center vip_fd3_1_c0">
						<!--  @confirm="checkCodeFunc()"-->
						<template #default="{ content, active, index }">
							<view :key="index" v-if="active"
								class="flex align-center justify-center active-digital-password vip_flex_password_active_fd3_1_c0">
								{{ content }}
							</view>
							<view :key="index" v-else
								class="flex align-center justify-center vip_flex_password_noActive_fd3_1_c0">
								{{ content }}
							</view>
						</template>
					</benben-digital-password>
				</view>
				<view class='flex align-center justify-between'>
					<button class='vip_fd3_2_c0' @tap.stop="closePsd">取消</button>
					<button class='vip_fd3_2_c1' @tap.stop="checkCodeFunc()">确认</button>
					<!-- @tap.stop="goumai()" -->
				</view>
			</view>
		</benben-popup>

	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	import back from "@/components/back/index.vue"
	import person from "@/components/person/index.vue"
	export default {
		components: {
			back,
			person
		},


		data() {
			return {
				"popupShow1683691899896": false,
				"popupShow1688203058831": false,
				"list": '',
				"benbenCalendar": {
					'width': 686,
					'background': '#ffffff',
					'borderRadius': '16rpx 16rpx 16rpx 16rpx',
					'mode': 'range',
					'future': false,
					'changeTitle': true,
					'changeYear': true,
					'changeMonth': true,
					'yearArrowColor': '#666666',
					'monthArrowColor': '#999999',
					'startText': '开始',
					'endText': '结束',
					'activeBgColor': 'rgba(41,121,255,1)',
					'rangeBgColor': 'rgba(41,121,255,0.13)'
				},
				"dateS": "",
				"dateE": "",
				jiage: {
					ads_price: "",
					ads_time: []
				},
				shijian: '',
				"PayPwd": "", // 支付密码
				ad_show: false,
				
				time: "",
				adTime: {
					ads_time: 0,
					ads_rights: ""
				},
				is_submit: false,
				
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getjiage();
			this.getAdTime();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			// 获取广告时间和权益   post659e49933b567
			getAdTime() {
				this.$api.post(global.apiUrls.post659e49933b567, {
					
				}).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						this.adTime = res.data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			timeEnd() {
				this.getAdTime();
			},
			closePsd() {
				this.PayPwd = '';
				this.popupShow1688203058831 = false;
			},
			checkCodeFunc() {
				if (!this.PayPwd) {
					this.$message.info('请输入支付密码');
					return;
				}
				this.queding();
			},
			//检测是否设置支付密码
			async getsetpay() {
				if (!validate(this.list, 'require')) {
					this.$message.info('请选择时间');
					return false;
				}
				// this.$api.post(global.apiUrls.queding, {
				// 	ads_time: this.list,
				// 	password: '',
				// 	from: 'h5'
				// }).then(res => {
				// 	if (res.data.code == 1) {
				// 		// setTimeout(() => {
				// 		// 	uni.navigateBack();
				// 		// }, 800)
				// 		this.is_submit = true;
				// 	} else {
				// 		this.$message.info(res.data.msg);
				// 	}
				// })
				// return
				
				
				
				let res = await this.$api.post(global.apiUrls.a6483dd30d089c, {})
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				if (res.data.data.is_set == 0) {
					this.$message.info('您还没有设置支付密码');
					setTimeout(() => {
						this.$urouter.navigateTo('/pages/xtsz/setpay/setpay')
					}, 800)
					return false
				} else {
					this.popupShow1688203058831 = true;
					return true
				}
			},
			//获取时间
			async getjiage() {
				let res = await this.$api.post(global.apiUrls.jiage, {});
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.jiage = res.data.data
				// console.log(this.jiage);
			},
			selectChange(e) {
				this.list = e.value;
			},
			//确定
			async queding() {
				this.popupShow1688203058831 = false;
				let res = await this.$api.post(global.apiUrls.queding, {
					ads_time: this.list,
					password: this.PayPwd,
					from: 'h5'
				});
				if (res.data.code == -1) {
					this.$message.info(res.data.msg)
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/qbgl/mySpecies/mySpecies'
						})
					}, 800)
					return
				} else if (res.data.code == 1) {
					this.$message.info(res.data.msg);
					this.PayPwd = '';
					// this.getAdTime();
					setTimeout(() => {
						uni.navigateBack();
					}, 800)
				} else if (res.data.code == 0) {
					this.PayPwd = '';
					this.$message.info(res.data.msg);
				}
			},

		}
	};
</script>
<style lang="scss" scoped>
	.upload_content {
		width: 690rpx;
		height: 552rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		opacity: 1;
		border: 1rpx solid #EEEEEE;
		.upload_1 {
			width: 250rpx;
			height: 180rpx;
			margin: 114rpx auto 96rpx;
		}
		.button_1 {
			width: 502rpx;
			height: 88rpx;
			background: #FAE5E6;
			border-radius: 44rpx;
			color: #8B060D;
			font-size: 32rpx;
			font-weight: bold;
			text-align: center;
			line-height: 88rpx;
			margin: 0 auto;
		}
		.tips {
			text-align: center;
			font-size: 30rpx;
		}
	}
	.authentication_fd1_1_c0_image_1 {
		width: 250rpx;
		height: 180rpx;
		margin: 0 auto;
	}
	.ad_content {
		border-radius: 24rpx;
		background: #fff;
		padding: 32rpx 24rpx;
		.ad_title {
			color: #8B060D;
			font-size: 28rpx;
			font-weight: 500;
			padding-bottom: 32rpx;
			border-bottom: 1px solid #eee;
		}
		.ad_quanyi {
			font-size: 28rpx;
			color: #333;
			font-weight: 500;
			padding: 32rpx 0 24rpx;
		}
		.ad_quanyi_text {
			color: #333333;
			font-size: 24rpx;
			font-weight: 400;
		}
	}
	.select_ad {
		padding: 32rpx 24rpx;
		background: #fff;
		border-radius: 24rpx;
		margin-top: 24rpx;
		.select_ad_title {
			font-weight: 500;
			font-size: 28rpx;
			padding-bottom: 1px solid #eee;
		}
		.select_ad_date {
			display: flex;
			align-items: center;
			margin: 36rpx 0 40rpx;
			.date_left {
				width: 173rpx;
				font-size: 28rpx;
				color: #666;
			}
			.date_right {
				width: 421rpx;
				height: 64rpx;
				background: #F8F8F8;
				border-radius: 8rpx;
			}
			.date_left_2 {
				width: 175rpx;
				font-size: 28rpx;
				color: #666;
			}
			.date_right_2 {
				font-size: 28rpx;
				color: #333;
			}
		}
	}
	
	
	
	.confirm_popup {
		width: 600rpx;
		height: 590rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		.popup_title {
			padding: 40rpx;
			font-size: 32rpx;
			font-weight: 500;
			display: flex;
			align-items: center;
			justify-content: space-between;
			image {
				width: 24rpx;
				height: 24rpx;
			}
		}
		.popup_cont {
			padding: 0 52rpx;
			.cont_item {
				display: flex;
				align-items: center;
				margin-bottom: 32rpx;
				.popup_cont_left {
					width: 114rpx;
					margin-right: 44rpx;
					font-size: 28rpx;
					color: #666;
					.xuyao {
						color: #B21E11;
					}
				}
				.popup_cont_right {
					.cont_right_date {
						font-size: 24rpx;
						color: #999999;
						margin-left: 12rpx;
					}
				}
			}
		}
		.popup_bottom {
			padding: 40rpx;
			border-top: 1px solid #eee;
			.confirm_btn {
				width: 520rpx;
				height: 88rpx;
				background: #6A0002;
				border-radius: 44rpx;
				color: #fff;
				font-weight: 500;
				font-size: 32rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}
	
	
	
	.vip_flex_311 {
		background: #fff;
		width: 540rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 32rpx 24rpx 24rpx 24rpx;
	}

	.vip_fd3_0_c0 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #000000;
	}

	.vip_fd3_1 {
		margin: 24rpx 0rpx 40rpx 0rpx;
	}

	::v-deep .vip_fd3_1_c0 {
		width: 750rpx;
		height: 160rpx;
	}

	.vip_flex_password_noActive_fd3_1_c0 {
		border: 1px solid #ccc;
		width: 68rpx;
		height: 68rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
	}

	.vip_fd3_2_c0 {
		background: #F2F2F2;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		font-size: 28rpx;
		color: #333;
		width: 234rpx;
		height: 72rpx;
		font-weight: 500;
		line-height: 72rpx;
	}

	.vip_fd3_2_c1 {
		background: #6a0002;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		font-size: 28rpx;
		color: #e6e6e6;
		width: 234rpx;
		height: 72rpx;
		font-weight: 500;
		line-height: 72rpx;
	}

	.vip_flex_password_active_fd3_1_c0 {
		border: 1px solid #409EFF;
		width: 68rpx;
		height: 68rpx;
		margin: 0rpx 5rpx 0rpx 5rpx;
	}




	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #f8f8f8;
		background-size: 100% auto !important;
	}

	.MyInformation_picker5_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
	}

	.MyInformation_picker5_0_c2 {
		color: #4781f5;
	}

	.advertisementManage_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.advertisementManage_fd0_0_c2 {
		width: 32rpx;
		height: 32rpx;
	}

	.advertisementManage_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.advertisementManage_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.advertisementManage_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.advertisementManage_flex_1 {
		padding: 69rpx 32rpx 0rpx 32rpx;
		background: url(@/static/images/125.png) no-repeat;
		background-size: 100% 349rpx;
		width: 100%;
		height: 349rpx;
	}

	.advertisementManage_fd1_0_c2 {
		font-size: 28rpx;
		color: rgba(191, 191, 191, 1);
	}

	.advertisementManage_fd1_0_c1 {
		text-align: right;
		margin: 0rpx 16rpx 0rpx auto;
		color: var(--benbenFontColor0);
		font-size: 32rpx;
	}

	.advertisementManage_fd1_0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
	}

	.advertisementManage_fd1_0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.advertisementManage_flex_2 {
		width: 750rpx;
		height: 152rpx;
		overflow: hidden;
		z-index: 1;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.advertisementManage_fd2_0 {
		background: #6A0002;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
	}
</style>